<?xml version="1.0" encoding="UTF-8"?>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<ui:composition template="/pages/templates/layout_principal.xhtml">

		<ui:define name="message">
			<rich:messages globalOnly="true" showSummary="true" showDetail="true">
			</rich:messages>
		</ui:define>

		<ui:define name="body">
		
		<h:form>
				
				<h:inputHidden value="#{manterRecursoControl.recurso.idRecurso}" rendered="#{manterRecursoControl.operacao == 'Alterar'}"/>
				
				<h:panelGrid styleClass="titulo">
					<h:outputText styleClass="titulo" value="Cadastrar Recurso"  />
				</h:panelGrid>
				<br />

				<rich:collapsiblePanel header="Informações Recurso" switchType="client">
					<h:panelGrid columns="3">

						<h:outputText value="*Nome Completo:" styleClass="form_label" />
						<h:inputText value="#{manterRecursoControl.recurso.nomeRecurso}" id="nomeCompleto" required="true" label="Nome Completo" maxlength="100"/>
						<rich:message for="nomeCompleto" />
						
						<h:outputText value="*Login:" styleClass="form_label" />
						<h:inputText value="#{manterRecursoControl.recurso.loginRecurso}" id="login" required="true" label="Login: " maxlength="100"/>
						<rich:message for="login" />
						
						<h:outputText value="*Email:" styleClass="form_label" />
						<h:inputText value="#{manterRecursoControl.recurso.emailRecurso}" id="email" required="true" label="Nome Completo" maxlength="100"/>
						<rich:message for="email" />
						
							<h:outputText value="*Senha:" styleClass="form_label" />
						<h:inputText value="#{manterRecursoControl.recurso.senhaRecurso}" id="senha" required="true" label="Nome Completo" maxlength="100"/>
						<rich:message for="senha" />
						
						<h:outputText value="*Papel:" styleClass="form_label" />
				
						
						<h:selectOneMenu id="selPapel"  value="#{manterRecursoControl.recurso.papel.idPapel}" >
							<f:selectItems value="#{manterRecursoControl.listPapel}" var="p" itemValue="#{p.idPapel}" itemLabel="#{p.nomePapel}" />
						</h:selectOneMenu>
						
						<rich:message for="selPapel" />
						
						<h:outputText value="Cargo:" styleClass="form_label" />
						<h:inputText value="#{manterRecursoControl.recurso.cargo}" id="cargo" required="true" label="Cargo" maxlength="100"/>
						<rich:message for="cargo" />
						
						
					</h:panelGrid>
					
				</rich:collapsiblePanel>
				<br />
				<h:panelGrid columns="3" cellpadding="3" styleClass="botoes">
					<h:commandButton action="#{manterRecursoControl.incluirRecurso()}" value="Salvar recurso" rendered="#{manterRecursoControl.operacao == 'Incluir'}" />
					<h:commandButton action="#{manterRecursoControl.alterarRecurso()}" value="Alterar recurso" rendered="#{manterRecursoControl.operacao == 'Alterar'}" />
					<h:commandButton action="#{manterRecursoControl.excluirRecurso()}" value="Excluir recurso" rendered="#{manterRecursoControl.operacao == 'Excluir'}" />
					<h:commandButton action="/pages/inicial.xhtml" value="Voltar" immediate="true" />
				</h:panelGrid>
			</h:form>
		</ui:define>
	</ui:composition>

</ui:component>